package edu.avans.hartigehap.domain;

import edu.avans.hartigehap.domain.Order.OrderStatus;

public class ConceptState implements State
{
	private Order order;
	
	public ConceptState(Order order)
	{
		this.order = order;
	}
	
	@Override
	public void fill()
	{
		
	}
	
	@Override
	public void empty()
	{
		order.setWebStatus(order.getEmptyState());
	}
	
	@Override
	public void submit() throws StateException
	{
		if (order.getOrderStatus() != OrderStatus.CREATED) {
			throw new StateException(
					"not allowed to submit an already submitted order");
		}
		order.setOrderStatus(OrderStatus.SUBMITTED);
		order.setWebStatus(order.getSubmittedState());
	}
}